<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
  <meta charset="utf-8">
  <title>GDB 編譯＆安裝</title>
  <meta name="author" content="Jason">



  <!-- http://t.co/dKP3o1e -->
  <meta name="HandheldFriendly" content="True">
  <meta name="MobileOptimized" content="320">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="./favicon.png" rel="icon">
  <link href="./theme/css/main.css" media="screen, projection"
        rel="stylesheet" type="text/css">
  <script src="./theme/js/modernizr-2.0.js"></script>
  <script src="./theme/js/ender.js"></script>
  <script src="./theme/js/octopress.js" type="text/javascript"></script>

  <link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic"
        rel="stylesheet" type="text/css">
  <link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic"
        rel="stylesheet" type="text/css">
</head>

<body>
  <header role="banner"><hgroup>
  <h1><a href="./">Jason Blog</a></h1>
</hgroup></header>
  <nav role="navigation"><ul class="subscription" data-subscription="rss">
</ul>



<ul class="main-navigation">
    <li >
    <a href="./category/c.html">C</a>
    </li>
    <li class="active">
    <a href="./category/gdb.html">Gdb</a>
    </li>
    <li >
    <a href="./category/github.html">Github</a>
    </li>
    <li >
    <a href="./category/glib.html">Glib</a>
    </li>
    <li >
    <a href="./category/opencv.html">Opencv</a>
    </li>
    <li >
    <a href="./category/pelican.html">Pelican</a>
    </li>
    <li >
    <a href="./category/protocol.html">Protocol</a>
    </li>
    <li >
    <a href="./category/python.html">Python</a>
    </li>
    <li >
    <a href="./category/regular.html">Regular</a>
    </li>
    <li >
    <a href="./category/sed.html">Sed</a>
    </li>
    <li >
    <a href="./category/stock.html">Stock</a>
    </li>
</ul></nav>
  <div id="main">
    <div id="content">
<div>
  <article class="hentry" role="article">
<header>
      <h1 class="entry-title">GDB 編譯＆安裝</h1>
      <p class="meta"><time datetime="2014-11-30T19:08:34" pubdate>日 30 十一月 2014</time></p>
</header>

  <div class="entry-content"><div class="highlight"><pre><span class="nl">ftp:</span><span class="c1">//sourceware.org/pub/gdb/releases/</span>
<span class="n">tar</span> <span class="n">xfv</span> <span class="n">gdb</span><span class="o">-</span><span class="mf">7.8.1</span><span class="p">.</span><span class="n">tar</span><span class="p">.</span><span class="n">gz</span>
<span class="n">cd</span> <span class="n">gdb</span><span class="o">-</span><span class="mf">7.8.1</span>
<span class="p">.</span><span class="o">/</span><span class="n">configure</span>
<span class="n">make</span> <span class="o">-</span><span class="n">j8</span>
<span class="n">sudo</span> <span class="n">ake</span> <span class="n">install</span>
</pre></div>


<div class="highlight"><pre><span class="n">gdb</span> <span class="err">會出現</span>  <span class="sc">&#39;g&#39;</span> <span class="n">packet</span> <span class="n">reply</span> <span class="n">is</span> <span class="n">too</span> <span class="kt">long</span><span class="o">:</span>

<span class="cp">###修改gdb/remote.c文件，屏蔽process_g_packet函数中的下列两行：</span>
<span class="k">if</span> <span class="p">(</span><span class="n">buf_len</span> <span class="o">&gt;</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">rsa</span><span class="o">-&gt;</span><span class="n">sizeof_g_packet</span><span class="p">)</span>
    <span class="n">error</span> <span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="err">“</span><span class="n">Remote</span> <span class="err">‘</span><span class="n">g</span><span class="err">’</span> <span class="n">packet</span> <span class="n">reply</span> <span class="n">is</span> <span class="n">too</span> <span class="kt">long</span><span class="o">:</span> <span class="o">%</span><span class="n">s</span><span class="err">”</span><span class="p">),</span> <span class="n">rs</span><span class="o">-&gt;</span><span class="n">buf</span><span class="p">);</span>
<span class="err">在其后添加：</span>
<span class="k">if</span> <span class="p">(</span><span class="n">buf_len</span> <span class="o">&gt;</span> <span class="mi">2</span> <span class="o">*</span> <span class="n">rsa</span><span class="o">-&gt;</span><span class="n">sizeof_g_packet</span><span class="p">)</span> <span class="p">{</span>
      <span class="n">rsa</span><span class="o">-&gt;</span><span class="n">sizeof_g_packet</span> <span class="o">=</span> <span class="n">buf_len</span> <span class="p">;</span>
      <span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">gdbarch_num_regs</span> <span class="p">(</span><span class="n">gdbarch</span><span class="p">);</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
         <span class="k">if</span> <span class="p">(</span><span class="n">rsa</span><span class="o">-&gt;</span><span class="n">regs</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">pnum</span> <span class="o">==</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
         <span class="k">continue</span><span class="p">;</span>

         <span class="k">if</span> <span class="p">(</span><span class="n">rsa</span><span class="o">-&gt;</span><span class="n">regs</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">offset</span> <span class="o">&gt;=</span> <span class="n">rsa</span><span class="o">-&gt;</span><span class="n">sizeof_g_packet</span><span class="p">)</span>
         <span class="n">rsa</span><span class="o">-&gt;</span><span class="n">regs</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">in_g_packet</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
         <span class="k">else</span>
         <span class="n">rsa</span><span class="o">-&gt;</span><span class="n">regs</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">in_g_packet</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
      <span class="p">}</span>
<span class="p">}</span>
</pre></div></div>
    <footer>
<p class="meta">
  <span class="byline author vcard">
    Posted by <span class="fn">Jason</span>
  </span>
<time datetime="2014-11-30T19:08:34" pubdate>日 30 十一月 2014</time>  <span class="categories">
    <a class="category" href="./tag/gdb.html">gdb</a>
  </span>
</p><div class="sharing">
</div>    </footer>
  </article>

</div>
<aside class="sidebar">
  <section>
    <h1>Recent Posts</h1>
    <ul id="recent_posts">
      <li class="post">
          <a href="./glib-bian-yi-an-zhuang.html">Glib 編譯& 安裝</a>
      </li>
      <li class="post">
          <a href="./gdb-bian-yi-an-zhuang.html">GDB 編譯＆安裝</a>
      </li>
      <li class="post">
          <a href="./zhuan-spiuarti2cdu-you-shi-mo-qu-bie-ji-qi-ge-zi-de-te-dian.html">[轉] SPI,UART,I2C都有什麼區別，及其各自的特點</a>
      </li>
      <li class="post">
          <a href="./zhuan-ben-yi-bi-per-gu-jia-jing-zhi-bi-pbr-gu-dong-quan-yi-bao-chou-lu-roe.html">[轉] 本益比(PER)、股價淨值比(PBR)、股東權益報酬率(ROE)</a>
      </li>
      <li class="post">
          <a href="./search-struct-or-class-prototype.html">search struct or class prototype</a>
      </li>
    </ul>
  </section>
  <section>
      
    <h1>Categories</h1>
    <ul id="recent_posts">
        <li><a href="./category/c.html">C</a></li>
        <li><a href="./category/gdb.html">GDB</a></li>
        <li><a href="./category/github.html">github</a></li>
        <li><a href="./category/glib.html">Glib</a></li>
        <li><a href="./category/opencv.html">opencv</a></li>
        <li><a href="./category/pelican.html">Pelican</a></li>
        <li><a href="./category/protocol.html">protocol</a></li>
        <li><a href="./category/python.html">Python</a></li>
        <li><a href="./category/regular.html">regular</a></li>
        <li><a href="./category/sed.html">sed</a></li>
        <li><a href="./category/stock.html">stock</a></li>
    </ul>
  </section>
 

  <section>
  <h1>Tags</h1>
    <a href="./tag/glib.html">Glib</a>,    <a href="./tag/pelican.html">Pelican</a>,    <a href="./tag/c.html">C</a>,    <a href="./tag/github.html">github</a>,    <a href="./tag/sed.html">sed</a>,    <a href="./tag/python.html">python</a>,    <a href="./tag/protocl.html">Protocl</a>,    <a href="./tag/opencv.html">opencv</a>,    <a href="./tag/gdb.html">gdb</a>,    <a href="./tag/regular.html">regular</a>,    <a href="./tag/protocol.html">protocol</a>,    <a href="./tag/stock.html">stock</a>  </section>


    <section>
        <h1>Social</h1>
        <ul>
            <li><a href="#" target="_blank">You can add links in your config file</a></li>
            <li><a href="#" target="_blank">Another social link</a></li>
        </ul>
    </section>
    <section>
        <h1>Blogroll</h1>
        <ul>
            <li><a href="http://getpelican.com/" target="_blank">Pelican</a></li>
            <li><a href="http://python.org/" target="_blank">Python.org</a></li>
            <li><a href="http://jinja.pocoo.org/" target="_blank">Jinja2</a></li>
            <li><a href="#" target="_blank">You can modify those links in your config file</a></li>
        </ul>
    </section>

</aside>    </div>
  </div>
  <footer role="contentinfo"><p>
  Copyright &copy; 2013 - Jason -
  <span class="credit">Powered by <a href="http://getpelican.com">Pelican</a></span>
</p></footer>
</body>
</html>